#ifndef FILTERVIEW_H
#define  FILTERVIEW_H
#include "filter.h"
#include <gtkmm.h>
#include <libsexymm/icon-entry.h>
#include "docview.h"
#include "documents.h"
#include "filterbutton.h"
//#include "filterhlist.h"

class DocView;

class FilterView:public Gtk::HBox
{
public:
    FilterView();
    virtual ~FilterView();
    void set_documents(sdms::documents* doc);
    void set_docview(DocView*);
    virtual void clear();
    virtual void update();
    virtual void remove(std::string);
    virtual void add(const sdms::PublisherFilter&);
    virtual void add(const sdms::WritingFilter&);
    virtual void add(const sdms::TagFilter&);
    virtual void add(const sdms::Filter&);
    //std::vector<Glib::RefPtr<Gtk::Label*>> filterlabel;
    sdms::Filter resultfilter;
    std::vector<sdms::Filter> myfilters;

    //void update();
    //void add(sdms::Filter&,std::string& op);
protected:
    void onSearchChanged();
    void onIconClicked(Sexy::IconEntryPosition pos,int button);
    void onChoiceChanged(unsigned int);
    void onAdvanceSearch();
    void onEntryIn();
    bool onEntryOut(GdkEventFocus* event);
    void onEntryActivate();
    void initEntry();
    void onDataReceived(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y,const Gtk::SelectionData& selection_data, guint, guint time);
    virtual void onRightClick();
    virtual void onLeftClick();
private:
    //Gtk::Entry search;
    Sexy::IconEntry search;
    Gtk::Menu iconpopup;
    Gtk::HBox m_filterbox;
    Gtk::Button m_leftbutton,m_rightbutton;
    Gtk::ScrolledWindow * m_scrolledwindow;
    //FilterHList m_filterwinow;
    unsigned int search_key;
    bool nocontent;
    bool has_searched;

    sdms::documents* mydoc;
    DocView* docview;
};
#endif
